import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useThemeStore = defineStore('theme', () => {
    const isDark = ref(false)

    function toggleTheme() {
        isDark.value = !isDark.value
    }

    function setTheme(dark) {
        isDark.value = dark
    }

    return { isDark, toggleTheme, setTheme }
}, {
    persist: true // 启用持久化
}) 